function skipOpen(gnurl, gnid, title) {
    if (CoreUtil.isEmpty(gnurl) || CoreUtil.isEmpty(gnid) || CoreUtil.isEmpty(title)) {
        return false;
    } else {
        var gnurlArr = gnurl.split(",");
        var gnidArr = gnid.split(",");
        var titleArr = title.split(",");
        for (var i in gnurlArr) {
            tianzhuan(gnurlArr[i], gnidArr[i], titleArr[i])
        }
    }
}

//触发事件
var active = {
    tabAdd: function (url, id, title) {
        if (url !== "" && url !== null && url !== undefined) {
            window.parent.parent.layui.element
                .tabAdd(
                    'tab',
                    {
                        title: title,
                        content: '<iframe data-frameid="'
                            + id
                            + '" frameborder="0" name="content" width="100%" src="'
                            + url + '"></iframe>',
                        id: id
                    })
        }
        FrameWH();//计算框架高度
    },
    tabChange: function (id) {
        let iframe = $("iframe[data-frameid='" + id + "']");
        //切换到指定Tab项
        window.parent.parent.layui.element.tabChange('tab', id); //切换到：用户管理
        iframe.attr("src", iframe.attr("src"))//切换后刷新框架
    },
    /* tabDelete : function(id) {
        element.tabDelete("tab", id);//删除
    } */
};

function tianzhuan(gnurl, gnid, title) {
    if ($(".layui-tab-title li[lay-id]").length <= 0) {
        var title = "<span>" + title + "</span>";
        active.tabAdd(gnurl, gnid, title);
    } else {
        var isData = false;
        $.each($(".layui-tab-title li[lay-id]"),
            function () {
                if ($(this).attr("lay-id") == dataid.attr("data-id")) {
                    isData = true;
                }
            })

        if (isData === false) {
            if (CoreUtil.isEmpty(dataid
                .attr("data-icon"))) {
                var title = "<span>"
                    + dataid.attr("data-title")
                    + "</span>";
                active.tabAdd(dataid.attr("data-url"),
                    dataid.attr("data-id"), title);
            } else {
                var title = "<span>"
                    + dataid.attr("data-title")
                    + "</span>";
                title = '<i class="layui-icon '
                    + dataid.attr("data-icon")
                    + '"></i> ' + title;
                active.tabAdd(dataid.attr("data-url"),
                    dataid.attr("data-id"), title);
            }
        }
    }
    active.tabChange(gnid);
}

function FrameWH() {
    const h = $(window).height();
    $(window.parent.parent.document).find("iframe").css("height", h + "px");
}
